﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ListBusiness.ascx.cs" Inherits="Team4Mock.UserControl.BusinessType.ListBusiness" %>
<style type="text/css">
    .style1
    {
        width: 109px;
    }
    .style2
    {
        width: 104px;
    }
    .style3
    {
        width: 246px;
    }
    .button
    {
        background-color: #465c71;
        width: 80px;
        height: 26px;
        line-height: 26px;
        text-align: center;
        -webkit-border-radius: 3px;
        color: White;
    }
    .button:hover
    {
        background-color: #bfcbd6;
        color: #465c71;
    }
    #txtFirstName
    {
        width: 160px;
    }
</style>
<script type="text/javascript">
    function Return() {
        var Str = document.getElementsByName('select').length;
        for (var i = 0; i < document.getElementsByName('select').length; i++) {
            var a = document.getElementsByName('select').item(i).checked;
            if (a == true) {
                window.opener.document.getElementById('txtBusID').value = document.getElementsByName('select').item(i).value;
                window.opener.document.getElementById('txtSICCode').value = document.getElementsByName('siccode').item(i).value;
                window.opener.document.getElementById('idBus').value = document.getElementsByName('idBusiness').item(i).value;
                window.close();
            }
        }

    }
    function Close() {
        window.close();
    }
</script>

<fieldset style="width: 760px;">
    <legend style="height: 25px; background-color: #465c71; -webkit-border-radius: 5px 5px 0px 0px;
        color: #dde4ec;font-size:18px;">Search Business Type</legend>
    <div style="width: 750px; margin-left: 10px;">
        
        <br />
        <table cellpadding="0" cellspacing="0" border="0">
            <tr>
                <td class="style1">
                    Business Name
                </td>
                <td class="style3">
                    <asp:TextBox ID="txtBusName" runat="server" Width="160px"></asp:TextBox>
                </td>
                <td class="style2">
                    SIC Code
                </td>
                <td>
                    <asp:TextBox ID="txtSICCode" runat="server" Width="160px"></asp:TextBox>
                </td>
            </tr>
        </table>
        <asp:Button ID="btnSearch" runat="server"  CssClass="button"
            Text="Search" />
        <asp:Button ID="btnNone" runat="server" CssClass="button" Text="None" />
        <asp:Button ID="btnClear" runat="server" CssClass="button" Text="Clear" />
        <br />
        <br />
        <asp:GridView ID="gvBus" AutoGenerateColumns="False" DataKeyNames="ID" runat="server"
            Width="709px" Font-Size="15px" BackColor="White" BorderColor="#CCCCCC" AllowSorting="true"
            BorderStyle="None" BorderWidth="1px" CellPadding="3">
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                        <input type="radio" id="radio" name="select" value='<%#Eval("Name") %>' />
                        <input type="hidden" name="idBusiness" value='<%#Eval("ID") %>' />
                    </ItemTemplate>
                    <ItemStyle Width="40px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="ID" Visible="false">
                    <ItemTemplate>
                        <asp:Label ID="lbID" runat="server" Text='<%#Eval("ID") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Business Name">
                    <ItemTemplate>
                        <asp:HyperLink ID="OrgName" runat="server" Text='<%#Eval("Name") %>'></asp:HyperLink>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="SIC Code">
                    <ItemTemplate>
                        <input type="hidden" name="siccode" value='<%#Eval("SIC") %>' />
                        <asp:Label ID="lbHOA" runat="server" Text='<%#Eval("SIC") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                
            </Columns>
            <FooterStyle BackColor="White" ForeColor="#000066" />
            <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
            <RowStyle ForeColor="#000066" />
            <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
        </asp:GridView>
        <br />
        <asp:Button ID="btnSelect" runat="server" OnClientClick="Return()" 
            CssClass="button" Text="Select" />
        <asp:Button ID="btnClose" runat="server" CssClass="button" Text="Close" OnClientClick="Close()" />
        <br />
    </div>
</fieldset>